package com.itheima.test02;

import java.sql.ClientInfoStatus;
import java.util.ArrayList;
import java.util.Collections;

/*
♠   ♥   ♣   ♦
2345678910JQKA
大王  小王

 */
public class Test08 {
    public static void main(String[] args) {
        String[] color = {"♠", "♥", "♣", "♦"};
        String[] num = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};
        ArrayList<String> poker = new ArrayList<>();
        for (String c : color) {
            for (String n : num) {
                poker.add( c+n);

            }
        }
        poker.add("大王");
        poker.add("小王");
//        System.out.println(poker);
        Collections.shuffle(poker);
//        System.out.println(poker);
        ArrayList<String> dipai = new ArrayList<>();
//        dipai.add(poker.get(poker.size()-2));
//        dipai.add(poker.get(poker.size()-3));
//        dipai.add(poker.get(poker.size()-4));
        System.out.println();
        ArrayList<String> player1 = new ArrayList<>();
        ArrayList<String> player2 = new ArrayList<>();
        ArrayList<String> player3 = new ArrayList<>();
        //%3   0 1  2
        for (int i = 0; i < poker.size(); i++) {
            if(i>=poker.size()-3){
                dipai.add(poker.get(i));
            }
            if (i % 3 == 0) {
                player1.add(poker.get(i));
            }
            if (i % 3 == 1) {
                player2.add(poker.get(i));
            }
            if (i % 3 == 2) {
                player3.add(poker.get(i));
            }
        }
        Collections.sort(player1);
        Collections.sort(player2);
        Collections.sort(player3);


        System.out.println("player1:"+player1);
        System.out.println("----------------");
        System.out.println("player2:"+player2);
        System.out.println("----------------");
        System.out.println("player3:"+player3);
        System.out.println("----------------");
        System.out.println("底牌:"+dipai);

    }
}
